<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>18-promise异常穿透</title>
</head>
<body>
    <script>
        let P1 = new Promise((resolve, reject) => {
            reject("error")
        });
        P1.then(value => {

        }).then(value => {
            
        }).then(value => {
            
        }).then(value => {
            
        }).catch(reason => {
            console.warn(reason)
        })

        let P2 = new Promise((resolve, reject) => {
            resolve("ok")
        });
        P2.then(value => {

        }).then(value => {
            throw "wrong"
        }).then(value => {
            
        }).then(value => {
            
        }).catch(reason => {
            console.warn(reason)
        })
    </script>
</body>
</html>